(function () {
    angular.module('KtotApp').directive('dropdown', function () {
        return {
            restrict: 'E',            
            replace: true,
            transclude: false,
            scope: {
                items: '=',
                caption: '=',
                selectedItem: '='
            },
            controller: function ($scope) {
                $scope.isVisible = false;
                $scope.selectItem = function (item) {
                    $scope.selectedItem = item;
                    $scope.isVisible = false;
                };

                $scope.show = function () {
                    $scope.isVisible = true;
                }; 
            },
            templateUrl: Utils.getTemplate('dropdown')
        };
    });
})();